package com.tongcao.cn.mq.listner;

import com.alibaba.rocketmq.client.exception.MQClientException;
import com.tongcao.cn.mq.handle.IMessageHandle;

import java.io.IOException;
import java.util.Properties;

/**
 * @Author:tongcao
 * @Date:2019/1/25 17:06
 * Description:
 */
public abstract class BaseConsumerListener {

    /**
     * 消息处理器
     */
    protected IMessageHandle messageHandle;

    /**
     * 属性
     */
    protected Properties consumerProperties;

    /**
     * topic
     */
    protected String topic;

    /**
     * Listener启动
     */
    abstract void start() throws IOException, MQClientException;

    abstract void close();


    public void setMessageHandle(IMessageHandle messageHandle) {
        this.messageHandle = messageHandle;
    }

    public void setConsumerProperties(Properties consumerProperties) {
        this.consumerProperties = consumerProperties;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }
}
